<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
    <meta name="description"
        content="Use Viewer to start building new applications or easily embed Cesium into existing applications." />
    <meta name="cesium-sandcastle-labels" content="Beginner, Showcases" />
    <title>三环动态运行</title>
    <script type="text/javascript" src="../Sandcastle-header.js"></script>
    <script type="text/javascript" src="../../../Build/CesiumUnminified/Cesium.js" nomodule></script>
    <script type="module" src="../load-cesium-es6.js"></script>
</head>

<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
    <style>
        @import url(../templates/bucket.css);
    </style>
    <div id="cesiumContainer" class="fullSize"></div>
    <div id="loadingOverlay">
        <h1>Loading...</h1>
    </div>
    <div id="toolbar"></div>
    <script id="cesium_sandcastle_script">
        window.startup = function (Cesium) {
            "use strict";
            //Sandcastle_Begin

            //先加载czml文件
            var czml = [{
                "id": "document",
                "version": "1.0",
                "clock": {
                    "interval": "2022-07-26T12:00:00Z/2022-07-26T20:00:00Z",
                    "currentTime": "2022-07-26T12:00:00Z",
                    "multiplier": 10,
                }
            },
            {
                "id": "runner",
                "model": {
                    "gltf": "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb",
                },
                "position": {
                    "interpolationAlgorithm": "LINEAR",
                    "forwardExtrapolationType": "HOLD",
                    "cartesian": [
                        //PART1
                        "2022-07-26T12:00:00Z", -1336275.8741433048, 5332188.408773404, 3224659.744076464,
                        "2022-07-26T12:30:00Z", -1342341.789038301, 5330243.503293716, 3225351.0770991286,
                        "2022-07-26T13:00:00Z", -1346648.1588540194, 5328598.303245533, 3226268.098373901,
                        "2022-07-26T13:30:00Z", -1348400.1580389554, 5326125.188055712, 3229595.9032884794,
                        "2022-07-26T14:00:00Z", -1349007.1793516197, 5323896.951275159, 3232991.678729604,
                        //PART2
                        "2022-07-26T14:30:00Z", -1345797.6828742477, 5321776.030136474, 3237785.317099749,
                        "2022-07-26T15:00:00Z", -1345032.4079075565, 5319973.735387191, 3241041.5584685835,
                        "2022-07-26T15:30:00Z", -1339343.9176600499, 5319062.653183529, 3244864.6148009845,
                        "2022-07-26T16:00:00Z", -1333906.57324865, 5319945.706224094, 3245651.3264347776,
                        //PART3
                        "2022-07-26T16:30:00Z", -1326179.481606162, 5322644.696367443, 3244400.97720926,
                        "2022-07-26T17:00:00Z", -1322054.0042529434, 5324920.632321519, 3242363.1557283318,
                        "2022-07-26T17:30:00Z", -1321708.6782137435, 5326668.963434283, 3239649.338169094,
                        "2022-07-26T18:00:00Z", -1321868.3354699183, 5329839.896205349, 3234400.0548000657,
                        //PART4
                        "2022-07-26T18:30:00Z", -1324561.465671141, 5331536.366250529, 3230526.057537851,
                        "2022-07-26T19:00:00Z", -1328204.548721701, 5332611.164540449, 3227276.5561483405,
                        "2022-07-26T19:30:00Z", -1332980.9032816861, 5332368.774490892, 3225717.915439177,
                        "2022-07-26T20:00:00Z", -1336275.8741433048, 5332188.408773404, 3224659.744076464,
                    ],
                },
                "orientation": {
                    "velocityReference": "#position"
                },
            }];

            //加载三维地球

            const viewer = new Cesium.Viewer("cesiumContainer", {
                terrainProvider: new Cesium.CesiumTerrainProvider({
                    url: Cesium.IonResource.fromAssetId(3957),
                    requsestVertexNormal: true,
                    requestWaterMask: true
                })
            });

            viewer._cesiumWidget._creditContainer.style.display = "none";

            //添加动画示例
            viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function (ds) {
                viewer.trackedEntity = ds.entities.getById('runner');
            });

            //Sandcastle_End
            Sandcastle.finishedLoading();
        };
        if (typeof Cesium !== "undefined") {
            window.startupCalled = true;
            window.startup(Cesium);
        }
    </script>
</body>

</html>